Hello All;
I found this code that was initially developed for Delphi 2 (I think)
---Code Supplied----
{This changes the Size of the form itself for other resolution's)
const
ScreenWidth : LongInt =1024;
ScreenHeight : LongInt =768;
///FormCreate
begin
scaled := true;
if (screen.Width <> ScreenWidth) then
begin
height := LongInt(height) * LongInt(Screen.height) div ScreenHeight;
width := LongInt(width) * LongInt(Screen.Width) div ScreenWidth;
scaleBy(Screen.Width, ScreenWidth);
{This compiles and works great under Delphi 6 Pro}
{The code for resizing the Fonts}
type
TFooClass = Class(TControl); {Needed to get at protected}
{Font Sizes}
{I think that this part goes under the OnCreate As well}
var
I : Integer;
begin
for I := ControlCount - 1 downto 0 do
TFooClass(controls[i]).Font.Size :=
(NewFormWidth div OldFormWidth) *
TFooClass(Controls[i]).Font.Size;
end;
---End Code for Resizing Screen Resolution--
In the last part of the code, I get an error
[Error] Form2.pas(324): Undeclared identifier: 'NewFormWidth'
[Error] Form2.pas(324): Undeclared identifier: 'OldFormWidth'
I tried to put the code like this:
var
NewFormWidth : integer;
OldFormWidth : Integer;
But I end up with it saying that they may not have been initialized?
------------
If their is a better way of doing this in Delphi 6 Please, Please let me
know.
As the first part of the code does very well in resizing the form in an 800
X 600
Resolution. But the fonts I need them to be resized as well. Along .
Please help anyone.
Wayne
--
Carrz-Fox-Fire Promotions
Delphi 6 Pro SP2 | Win2k SP2|
http://www.carrz-fox-fire.com/Delphi/Delphi_Fire_Security/Main.asp
//Delphi Components and Source Code page, For members only, Sign up today
[Free for now]
http://www.carrz-fox-fire.com/Delphi/Delphi_Fire_Security/EmailList/Confirm.
asp
//Delphi TWebBrowser & TEmbeddeedWB Mailing List, Join Today
I assume that this two values should be two private properties of the
form, which store the old Form.Width, i.e. the width of the form for
which the active font size has been defined and the new one, for which
the new font size is determined.
Regards from Germany
Franz-Leo
I then brought up the app on the 800 * 600 Screen Resolution and I get
the following error
{ Division By Zero. }
I click thru the error, and then open the form that I have the resize code
under, and
it gives the same error. (But no other forms do)
I am taking that it is on this line here
>> for I := ControlCount - 1 downto 0 do
What would need to be done here?
Also, Does this code (if working properly) suppose to make the fonts on the
form
fit in all components, Like TLabel, TButton's exc.....
Wayne
"Franz-Leo Chomse" <franz-le...@samac.de> wrote in message
news:k65bcuggckl97949u...@4ax.com...
> Thank you Franz-Leo Chomse;
>I added the NewFormWidth & OldFormWidth as Integer;s to the Private
>And it compiled nicely.
>
> I then brought up the app on the 800 * 600 Screen Resolution and I get
>the following error
>
> { Division By Zero. }
You have to initialize the values . otherwise they are zero and the
division produces the above exception.
Regards from Germany
Franz-Leo
I hate to ask this?
But how do you initialize the Values????
Wayne
"Franz-Leo Chomse" <franz-le...@samac.de> wrote in message
news:7v6bcu4l8hdhust0j...@4ax.com...